/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author 7P7
 */
@Entity
@Table(name = "Speaker", catalog = "NationalLevelPaperPresentation", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Speaker.findAll", query = "SELECT s FROM Speaker s"),
    @NamedQuery(name = "Speaker.findBySpeakerID", query = "SELECT s FROM Speaker s WHERE s.speakerID = :speakerID"),
    @NamedQuery(name = "Speaker.findByJobTitle", query = "SELECT s FROM Speaker s WHERE s.jobTitle = :jobTitle"),
    @NamedQuery(name = "Speaker.findByMajorSubject", query = "SELECT s FROM Speaker s WHERE s.majorSubject = :majorSubject"),
    @NamedQuery(name = "Speaker.findByCollege", query = "SELECT s FROM Speaker s WHERE s.college = :college")})
public class Speaker implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "SpeakerID", nullable = false)
    private Integer speakerID;
    @Size(max = 200)
    @Column(name = "JobTitle", length = 200)
    private String jobTitle;
    @Size(max = 200)
    @Column(name = "MajorSubject", length = 200)
    private String majorSubject;
    @Size(max = 200)
    @Column(name = "College", length = 200)
    private String college;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "BiographicalInfo", length = 2147483647)
    private String biographicalInfo;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "Description", length = 2147483647)
    private String description;
    @OneToMany(mappedBy = "speakerID")
    private Collection<Event> eventCollection;
    @JoinColumn(name = "SpeakerID", referencedColumnName = "PerID", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Person person;

    public Speaker() {
    }

    public Speaker(Integer speakerID) {
        this.speakerID = speakerID;
    }

    public Integer getSpeakerID() {
        return speakerID;
    }

    public void setSpeakerID(Integer speakerID) {
        this.speakerID = speakerID;
    }

    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getMajorSubject() {
        return majorSubject;
    }

    public void setMajorSubject(String majorSubject) {
        this.majorSubject = majorSubject;
    }

    public String getCollege() {
        return college;
    }

    public void setCollege(String college) {
        this.college = college;
    }

    public String getBiographicalInfo() {
        return biographicalInfo;
    }

    public void setBiographicalInfo(String biographicalInfo) {
        this.biographicalInfo = biographicalInfo;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (speakerID != null ? speakerID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Speaker)) {
            return false;
        }
        Speaker other = (Speaker) object;
        if ((this.speakerID == null && other.speakerID != null) || (this.speakerID != null && !this.speakerID.equals(other.speakerID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Speaker[ speakerID=" + speakerID + " ]";
    }
    
}
